<?php

namespace Store\Controller;
use Store\Controller\StoreController;

class IndexController extends StoreController {
    
    function _initialize() {
        parent::_initialize();
        $this->assign('sys','home');// 数据集
        //$this->assign('action','coupon');// 页码
    }

    public function index() {
        
        $oModel = M('order');
        //今日订单数量
        $where['order_state'] = array('EGT',20);
        $where['store_id'] = session('store_id');
        $where['payment_time'] = array('EGT',strtotime(date('Y-m-d 00:00:30')));
        $todayOrder = $oModel->where($where)->count();
        $this->assign('todayOrder', $todayOrder);
        //今日销售额
        $todayMoney = $oModel->where($where)->sum('order_amount');
        $this->assign('todayMoney', $todayMoney);
        
        //今日发货数量
        $where1['order_state'] = 30;
        $where1['store_id'] = session('store_id');
        $where1['payment_time'] = array('EGT',strtotime(date('Y-m-d 00:00:30')));
        $todaySend = $oModel->where($where1)->count();
        $this->assign('todaySend', $todaySend);
        
        $re = getJson(15,'day','m-d');
        $this->assign('chartArray',$re);
        
        //p(session());
        $this->assign('action','index');// 页码
        $this->display();
    }
}
